package gcj2011.round1b;

import java.util.regex.Pattern;

import common.AbstractRunner;
import common.AbstractRunner.SIZE;

public class A extends AbstractRunner {
	Pattern p = Pattern.compile("(\\.|1|0)+");
	
	@Override
	public void handleCase(int caseNumber) throws Exception {		
		int n = scanner.nextInt();				
		int[][] a = new int[n][n];
		for (int i=0; i<n; i++) {
			String s = scanner.next(p);			
			for (int j=0; j<n; j++) {
				switch (s.charAt(j)) {
				case '.': a[i][j] = -1; break;
				case '0': a[i][j] = 0; break;
				case '1': a[i][j] = 1; break;
				default: throw new RuntimeException("Unrecognized symbol");
				}				
			}
		}
		
		int []score = new int[n];
		int []games = new int[n];
		//score
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < n; j++) {
				if (a[i][j] > 0) {
					score[i]++;
				}
				if (a[i][j] >= 0) {
					games[i]++;
				}
			}
		}
		
		double[] wp = new double[n];
		for (int i = 0; i < n; i++) {
			wp[i] = score[i]/(double)games[i];
		}
		
		//owp
		double [] owp = new double[n];		
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < n; j++) {
				if (a[i][j] >= 0) {					
					owp[i] += (score[j]- a[j][i])/(double)(games[j] - 1);			
				}
			}
			owp[i] /= games[i];		
		}		
		
		//oowp
		double [] oowp = new double[n];
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < n; j++) {
				if (a[i][j] >= 0) {					
					oowp[i] += owp[j];			
				}
			}
			oowp[i] /= games[i];
		}
		
		for (int i = 0; i < n; i++) {
			//System.out.println(String.format("%f %f %f", wp[i], owp[i], oowp[i]));
			double rpi = 0.25* wp[i] + 0.5*owp[i] + 0.25*oowp[i];
			out.write("\n"+rpi);
		}
		out.write("\n");
	}
	
	public static void main(String[] args) throws Exception {
		new A().init(SIZE.large).execute();
	}
}
